﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using hydrap2p;
namespace SearchInterface
{
    class SearchListener : hydrap2p.search.SearchListener.Iface
    {
        private Controller controller;
        public SearchListener(Controller controller)
        {
            this.controller = controller;
        }
        public void newSearch(int searchid, hydrap2p.search.SearchQuery query, List<String> providers)
        {
            controller.newSearch(searchid, query, providers);
        }
        public void delSearch(int searchid)
        {
            controller.searchDeleted(searchid);
        }
        public void addSearchResult(int searchid, hydrap2p.search.SearchResult result)
        {
            controller.addSearchResult(searchid, result);
        }
        public void searchFinished(int searchid)
        {
            controller.searchFinished(searchid);
        }
        public void searchProviderStarted(int searchid, String providername)
        {
            // Not implemented
        }
        public void searchProviderFinished(int searchid, String providername)
        {
            controller.searchProviderFinished(searchid, providername);
        }
        public void ping()
        {
            System.Console.WriteLine("PUNG!");
            return;
        }
        public List<String> supportedInterfaces()
        {
            return new List<String>() 
            {
                "Service",
                "SearchListener"
            };
        }
    }
}
